/**
 * Created by Administrator on 2017-04-07.
 */
const SET_BX_ID = 'SET_BX_ID'
const SET_TOTAL_PRICE = 'SET_TOTAL_PRICE'
const SET_TOTAL_COUNT = 'SET_TOTAL_COUNT'
const CLEAR_SELECT_FOODS = 'CLEAR_SELECT_FOODS'
const ADD_SELECT_FOODS = 'ADD_SELECT_FOODS'
const SET_GOODS = 'SET_GOODS'
const SET_FLAG = 'SET_FLAG'

export default {
  [SET_BX_ID] (state, payload) {
    state.bxid = payload.id
  },
  [SET_TOTAL_PRICE] (state, payload) {
    state.totalprice = payload.price
  },
  [SET_TOTAL_COUNT] (state, payload) {
    state.totalcount = payload.count
  },
  [CLEAR_SELECT_FOODS] (state) {
    state.selectfoods.length = 0
  },
  // 提交的mutation的示例 this.store.commit('increment', 10)
  [ADD_SELECT_FOODS] (state, payload) {
    state.selectfoods.push(payload.food)
  },
  [SET_GOODS] (state, payload) {
    state.goods = payload.goods
  },
  [SET_FLAG] (state) {
    state.flag = false
  }
}

